package com.ruoyi.flow.controller;

import com.ruoyi.flow.model.FlowResult;
import com.ruoyi.flow.model.FlowStartVo;
import com.ruoyi.flow.model.FlowSubmitVo;
import com.ruoyi.flow.service.FlowApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "流程接口")
@RestController
@RequestMapping("/flow/api")
public class FlowApiController {

    @Autowired private FlowApiService flowApiService;

    @PostMapping("/start")
    @ApiOperation(value = "启动工作流")
    public FlowResult start(@RequestBody FlowStartVo startVo) {
        return flowApiService.start(startVo);
    }

    @PostMapping("/submit")
    @ApiOperation(value = "提交工作流")
    public FlowResult submit(@RequestBody FlowSubmitVo submitVo) {
        return flowApiService.submit(submitVo);
    }
}
